package array;
import java.util.Arrays;
import java.util.HashMap;
import java.util.ArrayList;
//差集
public class Diff {
     public static void main(String[] args) throws Exception {
        String[] arr1 = { "one", "two", "three" };
        String[] arr2 = { "one", "two1", "three1" };
        ArrayList list1 = new ArrayList(Arrays.asList(arr1));
        ArrayList list2 = new ArrayList(Arrays.asList(arr2));
        list1.removeAll(list2);
        System.out.println(list1);

        list1.retainAll(list2);//交集
        System.out.println(list1);

        //并集
        // Merge m =  new Merge();
        // System.out.println("并集：" +m.merge2(arr1, arr2).toString());

        //并集
        HashMap map = new HashMap<>();
        for (String str : arr1) {
            map.put(str, str);
        }
        for (String str : arr2) {
            map.put(str, str);
        }
        System.out.println(map.values());


     }
    
}
